<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>维权处理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  
    {include file="public/css"}
    {include file="public/js"}
</head>
<body>
<!-- 后台面包屑导航 -->
{:get_admin_breadcrumb()}
<blockquote class="layui-elem-quote">订单信息</blockquote>
<div class=""  style="padding:20px">

   
<form class="layui-form" action="" method="post" >
<input type="hidden" name="id" value="{$Request.param.id}" class="id">



              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"> 所属订单</label>
                <div class="layui-input-inline" style="padding:8px">
                  #{$rights.order_id}
                </div>
                
              </div>
            <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"> 交易标题</label>
                <div class="layui-input-inline" style="padding:8px">
                  {$rights.title}
                </div>
                
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">维权状态</label>
                <div class="layui-input-inline" >
                 <div class="layui-form-mid layui-word-aux"> 
                     {if $rights.status ==0}
                       <span class="layui-badge layui-bg-gray">待处理</span>
                     {elseif $rights.status ==1}
                       <span class="layui-badge layui-bg-blue">已处理</span>
                     {elseif $rights.status ==2}
                       <span class="layui-badge">未成立</span>
                     {/if}
                 </div>
                   
                </div>
              </div>

             <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"> 维权发起人 </label>
                <div class="layui-input-inline" style="padding:8px">
                    {$rights.from_username}（{if $rights.role ==0}买家{elseif $rights.role ==1}卖家{/if}）
                  </div>

              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"> 维权对象 </label>
                <div class="layui-input-inline" style="padding:8px">
                   {$rights.to_username}（{if $rights.role ==0}卖家{elseif $rights.role ==1}买家{/if}）
                </div>
          
              </div>

              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"> 维权附件</label>
                <div class="layui-input-inline" style="width:500px;max-height:500px;padding:8px;overflow:hidden">
                  {if !empty($rights.image_url)}<img src="{$rights.image_url}" style="width:100%;height:auto" >{else}暂无附件{/if}
                </div>
                 <div class="layui-form-mid layui-word-aux"></div>
              </div> 

               <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"> 申请维权时间</label>
                <div class="layui-input-inline" style="padding:8px">
                {$rights.create_time|date="Y-m-d"}
                </div>
                 <div class="layui-form-mid layui-word-aux"></div>
              </div>
       
         <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">维权说明</label>
                <div class="layui-input-inline" style="padding:8px">
                 {$rights.content}
                </div>
                 <div class="layui-form-mid layui-word-aux"></div>
              </div>

              <div class="layui-form-item">
                  <label class="layui-form-label" style="width:100px;">维权处理结果</label>
                  <div class="layui-input-block" style="padding:8px">
                    {$rights.result}
                  </div>
                   <div class="layui-form-mid layui-word-aux"></div>
                </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"> 维权处理方案 </label> 
               
    {if $rights.status == 0}
       <div class="layui-input-block" >          
                     <div class="layui-form-mid layui-word-aux">本次订单可分配金额：{$rights['order']['price']} 元,请按照以下方式分配金额。</div>
                   
       </div> 


            <div class="layui-input-block" id="result" style="padding:8px">
                     <div class="layui-form-mid layui-word-aux">
                       买家（{if $rights.role == 0}
                           {$rights.from_username}
                           {else}
                           {$rights.to_username}
                         {/if}）
                         获得
                        
                        
                        </div>
                         
                          <div class="layui-input-inline" style="width:80px;">
                          <input type="text" name="buyer_get" id="buyer_get" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                         <div class="layui-form-mid layui-word-aux">元,
                            卖家（{if $rights.role == 1}
                            {$rights.from_username}
                            {else}
                            {$rights.to_username}
                          {/if}）获得</div>
                        <div class="layui-input-inline" style="width:80px;">
                          <input type="text" name="seller_get"  id="seller_get"  placeholder="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">元</div>
            </div>
     {elseif  $rights.status == 1}


        <div class="layui-input-block" >          
                     <div class="layui-form-mid layui-word-aux">  本次订单可分配金额：{$rights['order']['price']} 元,维权处理结果</div>
       </div> 
              <div class="layui-input-block" id="result" style="padding:8px">

                      <div class="layui-form-mid layui-word-aux">
                        
                          买家（{if $rights.role == 0}
                          {$rights.from_username}
                          {else}
                          {$rights.to_username}
                        {/if}）
                        获得
                        
                        </div>

             <div class="layui-input-inline" style="width:80px;">
                             <div class="layui-form-mid layui-word-aux">{$rights.buyer_get}</div>
                        </div>
                        <div class="layui-form-mid layui-word-aux">元, 
                            卖家（{if $rights.role == 1}
                            {$rights.from_username}
                            {else}
                            {$rights.to_username}
                          {/if}）获得
                          </div>
                        <div class="layui-input-inline" style="width:80px;">
                             <div class="layui-form-mid layui-word-aux">{$rights.seller_get}</div>
                        </div>
                        <div class="layui-form-mid layui-word-aux">元</div>
            </div>  


    {elseif  $rights.status == 2} 

            <div class="layui-input-inline" style="width:80px;">
              <div class="layui-form-mid layui-word-aux">{$rights.buyer_get}</div>
            </div>
                <div class="layui-form-mid layui-word-aux">元, 
                    卖家（{if $rights.role == 1}
                    {$rights.from_username}
                    {else}
                    {$rights.to_username}
                  {/if}）获得
                    </div>
              <div class="layui-input-inline" style="width:80px;">
                    <div class="layui-form-mid layui-word-aux">{$rights.seller_get}</div>
              </div>
            <div class="layui-form-mid layui-word-aux">元</div>
    </div>  
     {/if} 
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"></label>
                 <div class="layui-input-inline"  style="width:500px;margin-top:10px">
                  {if $rights.status == 0}
                    <button class="layui-btn layui-btn-normal"   id="success"><i class="layui-icon layui-icon-ok-circle"></i>处理维权</button>
                    <button class="layui-btn layui-btn-danger"   id="fail"><i class="layui-icon layui-icon-close-fill"></i>维权不成立</button>
                  {/if}
                    <a class="layui-btn layui-btn-primary"  onclick="back()">返 回</a>
                </div>
              </div>


</form>
</div>


<script>
  $(function(){
    $("#success").on('click',function(){
     var  buyer_get = $("#buyer_get").val();
     var  seller_get = $("#seller_get").val();
  
     if(buyer_get ==''){
          layer.msg('买家分配金额不能为空');
          return false;
      }
  
      if(seller_get ==''){
          layer.msg('卖家分配金额不能为空');
          return false;
      }
  
          $.post("{:url('guarantee/handle')}",{type:'success',id:$(".id").val(),seller_get:seller_get,buyer_get:buyer_get},function(json){
            if(json.code == 0){
              layer.msg(json.msg);
              location.reload();
  
            }else{
              layer.msg(json.msg);
            }
      });
       return false;
    });
  
    $("#fail").on('click',function(){
      var  buyer_get = $("#buyer_get").val();
      var  seller_get = $("#seller_get").val();
  
     if(buyer_get ==''){
      parent.layer.msg('买家分配金额不能为空');
          return false;
      }
  
      if(seller_get ==''){
        parent.layer.msg('卖家分配金额不能为空');
          return false;
      }
  
      parent.layer.prompt({title: '请输入维权不成立原因', formType: 2, maxlength: 200,}, function(value,index){
  
       $.post("{:url('guarantee/handle')}",{type:'fail',id:$(".id").val(),value:value,seller_get:seller_get,buyer_get:buyer_get},function(json){
            if(json.code == 0){
              parent.layer.msg(json.msg);
              parent.layer.close(index);
              
            setTimeout(function(){
              location.reload();
            },1000);
              
  
            }else{
              parent.layer.close(index);
              parent.layer.msg(json.msg);
            }
      });
  });
  
  
  
       return false;
    });
  });
  </script>
</body>

</html>